package com.sakura.hk.word.bean;

import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.Dispatch;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 结束时候触发
 *
 * @Author: 贺坤
 * @Date: 2021/10/14 11:07
 */

@Component
public class EndDisposableBean implements DisposableBean {
    /**
     *  word 程序对象本身
     */
    @Autowired
    private ActiveXComponent word;

    @Override
    public void destroy() throws Exception {
        // 结束的时候 讲word 对象关闭
        Dispatch.call(word, "Quit");
    }
}
